<template>
	<view class="">
		<s-pull-scroll ref="pullScroll" :pullDown="pullDown" :pullUp="loadData" :back-top="true">
			<view class="item-con flex-row items-center justify-between" v-for="(item,index) in dataList" :key="index" @click="navTo(`./questtionDetails?id=${item.id}&&name=${item.question}`)">
				<view class="item-title">
					{{index+1}}、{{item.question}}
				</view>
				<u-icon name="arrow-right" size="22"></u-icon>
			</view>
		</s-pull-scroll>
		<mix-loading v-if="isLoading"></mix-loading>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				dataList:[]
			}
		},
		onLoad() {
			this.refresh();
		},
		methods:{
			pullDown(pullScroll) {
				setTimeout(() => {
					this.loadData(pullScroll);
				}, 200);
			},
			async loadData(pullScroll) {
				if (pullScroll.page == 1) this.dataList = [];
				const res = await this.$request('content/question-list', {}, { showLoading: true });
				if (res.result == 0) {
					this.dataList = this.dataList.concat(res.data.list);
					pullScroll.endByPage(Math.ceil(res.data.count / 10), res.data.list);
				} else {
					this.$util.msg(res.resultNote);
				}
			}
		}
	}
</script>
<style scoped lang="scss">
	.item-con{
		height: 111rpx;
		background: #FFFFFF;
		border: 1rpx solid rgba(218, 218, 218, 0.18);
		padding: 0 20rpx;
		margin-bottom: 20rpx;
	}
	
</style>
